export default {
  methods: {
    checkTime (i) {
      if (i < 10) {
        i = `0${i}`
      }
      return i
    },
    timeFilter (time) {
      const date = new Date(time * 1000)
      return `${this.checkTime(date.getMonth() + 1)}月${this.checkTime(date.getDate())}日 ${this.checkTime(date.getHours())}:${this.checkTime(date.getMinutes())}`
    },
    timeFilter2 (time) {
      const date = new Date(time * 1000)
      return `${date.getFullYear()}/${this.checkTime(date.getMonth() + 1)}/${this.checkTime(date.getDate())} ${this.checkTime(date.getHours())}:${this.checkTime(date.getMinutes())}:${this.checkTime(date.getSeconds())}`
    },
    dateFilter (time) {
      const date = new Date(time * 1000)
      return `${this.checkTime(date.getMonth() + 1)}/${this.checkTime(date.getDate())}`
    },
    /**
     * 重置data
     */
    resetData () {
      Object.assign(this.$data, this.$options.data())
    }
  }
}
